﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeFirstSample
{
   class Program
   {
      static void Main(string[] args)
      {
         ListStudents();
      }

      private static void ListStudents()
      {
         using(var db = new AUSRIS_AcceptanceEntities())
         {

           

            db.au_Room.Add(new au_Room
            {
               LastUpdated = DateTime.Now,
               AddedBy = "Swindall, Jamie",
               AddedDate = DateTime.Now,
               UpdatedBy = "Swindall, Jamie",
               UpdatedDate = DateTime.Now,
               ViewOrder = 900,
               IsViewable = true,
               ProgramId = 1,
               Number = "1234567890",
               Phone = "(555)123-4567",
               Capacity = 150
            });
            db.SaveChanges();

            var rooms = from r in db.au_Room
                        where r.ProgramId == 1
                        orderby r.ViewOrder
                        select r;

            Console.WriteLine("Rooms for Program 1");
            foreach(var room in rooms)
            {
               Console.WriteLine("AddedBy: {0} -- Capacity: {1} -- Program: {2}",room.AddedBy,room.Capacity.ToString(),room.ProgramId.ToString());
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
         }
      }
   }




}
